@(project: String, task: String)

@widgets.dialog(title = "Import Reference Links", width = 500) {
  <table border="0">
    <tr>
      <td>File</td>
      <td>
        <form enctype="multipart/form-data">
          <input name="file" type="file" size="10"/>
        </form>
      </td>
    </tr>
    <tr>
      <td></td>
      <td><input id="generateNegative" type="checkbox" ><label for="generateNegative">Generate Negative Links</label></td>
    </tr>
  </table>

  <script>
    function submit() {
      var file = $("input[name='file']").val();
      var generateNegative = $("#generateNegative").is(':checked');
      var formData = new FormData($('form')[0]);

      $.ajax({
        type: 'PUT',
        url: '@config.baseUrl/linking/tasks/@project/@task/referenceLinks?generateNegative=' + generateNegative,
        xhr: function() {
          myXhr = $.ajaxSettings.xhr();
          return myXhr;
        },
        data: formData,
        cache: false,
        contentType: false,
        processData: false,
        success: function(data) {
          $('.dialog').dialog('close');
          window.location.reload();
        },
        error: function(request) {
          alert(request.responseText);
        }
      });
    }
  </script>
}